import {createStore, applyMiddleware, combineReducers, compose} from 'redux';
import createSagaMiddleware from 'redux-saga';

import rootSaga from '../sagas'


import {
    userList,
    userListPage,
    userAdd,
} from './reducers/userReducers';

import {default as test} from '../model/user';

console.log(test);



const composeEnhancers =
    typeof window === 'object' &&
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose;

const sagaMiddleware = createSagaMiddleware(rootSaga);

const enhancer = composeEnhancers(
    applyMiddleware(sagaMiddleware),
);


let store = createStore(
    combineReducers({
        userList,
        userListPage,
        userAdd,
    }),
    enhancer,
);

sagaMiddleware.run(rootSaga);

//store.runSaga = sagaMiddleware.run;
//store.close = () => store.dispatch(END);

export default store;




